#include "GComponentScene.h"



namespace GEngine
{

	void GComponentScene::OnTransformChange() OVERRIDE
	{
		FrameChanged = true;
	}

	GComponentScene::GComponentScene()
	{
		FrameChanged = true;
		WorldTransform = GMath::GMatrix4x4::Identity;
	}

	GComponentScene::~GComponentScene()
	{
	}

	GMath::GVector3 GComponentScene::GetWorldRight() const
	{
		return GMath::GVector3::UnitX * WorldTransform;
	}

	GMath::GVector3 GComponentScene::GetWorldUp() const
	{
		return GMath::GVector3::UnitY * WorldTransform;
	}

	GMath::GVector3 GComponentScene::GetWorldFront() const
	{
		return GMath::GVector3::UnitZ * WorldTransform;
	}

	const GMath::GMatrix4x4& GComponentScene::GetWorldTransform() const
	{
		return WorldTransform;
	}

	bool GComponentScene::Update(float FrameTime) OVERRIDE
	{
		//! consider hierarchical coordinate frames in future
		WorldTransform = LocalCoordFrame.GetTransformation();
		FrameChanged = false;

		return true;
	}
}